package cn.bonoon.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.bonoon.kernel.support.entities.AbstractPersistable;
import cn.bonoon.kernel.support.entities.EntityScopable;

/**
 * 
 * 用户的登录日志，跟操作日志一样，不能添加、修改、删除等操作，可以查看
 * 
 * @author jackson
 * 
 */
@Entity
@Table(name = "t_login")
public class LoginEntity extends AbstractPersistable implements EntityScopable {

	private static final long serialVersionUID = 3419128983583333206L;
	
	@Column(name = "C_SESSIONID", length = 300)
	private String sessionId;
	
	@Column(name = "C_LOGINNAME", length = 50)
	private String loginName;
	@Column(name = "C_USERNAME", length = 50)
	private String userName;

	@Column(name = "C_CREATORID")
	private Long creatorId;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_LOGINAT", nullable = false)
	private Date loginAt;

	@Column(name = "C_LOGINIP", length = 20)
	private String loginIp;

	/** 登录是否成功 */
	@Column(name = "C_LOGINSUCCESS")
	private boolean loginsuccess;

	/** 附加信息，如果登录失败，则显示登录失败的原因， 如果登录成功，则显示登录者的浏览器相关的信息 */
	@Column(name = "C_ADDINFO", length = 1024)
	private String additionalInfo;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_LOGOUTAT")
	private Date logoutAt;

	@Column(name = "C_OWNERID")
	private long ownerId;

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public Date getLoginAt() {
		return loginAt;
	}

	public void setLoginAt(Date loginAt) {
		this.loginAt = loginAt;
	}

	public String getLoginIp() {
		return loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}

	public Date getLogoutAt() {
		return logoutAt;
	}

	public void setLogoutAt(Date logoutAt) {
		this.logoutAt = logoutAt;
	}

	public boolean isLoginsuccess() {
		return loginsuccess;
	}

	public void setLoginsuccess(boolean loginsuccess) {
		this.loginsuccess = loginsuccess;
	}

	public String getAdditionalInfo() {
		return additionalInfo;
	}

	public void setAdditionalInfo(String additionalInfo) {
		this.additionalInfo = additionalInfo;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserName() {
		return userName;
	}

	public long getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(long ownerId) {
		this.ownerId = ownerId;
	}

	public Long getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

}
